//
//  GlobalMacros.h
//  JPWords
//
//  Created by 梁淑婷 on 2024/4/19.
//

#ifndef GlobalMacros_h
#define GlobalMacros_h


//设备
#define isIPHONE_X_After ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone && [[UIScreen mainScreen] bounds].size.height >= 812)
#define isIPAD ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
#define kNAVIGATIONBAR_HEIGHT 64.0
#define kNAVIGATIONBAR_HEIGHT_X 88
#define kNAVIGATIONBAR_HEIGHT_IPAD 64
#define kSTATUSBAR_HEIGHT 20
#define kSTATUSBAR_HEIGHT_X 44
#define kSTATUSBAR_HEIGHT_IPAD 20
#define kTABBAR_HEIGHT 49
#define kTABBAR_HEIGHT_X 83
#define kTABBAR_HEIGHT_IPAD 83
#define kYM_NAVIGATIONBAR_HEIGHT (isIPAD ? kNAVIGATIONBAR_HEIGHT_IPAD : (isIPHONE_X_After ? kNAVIGATIONBAR_HEIGHT_X : kNAVIGATIONBAR_HEIGHT))
#define kYM_STATUSBAR_HEIGHT (isIPAD ? kSTATUSBAR_HEIGHT_IPAD : (isIPHONE_X_After ? kSTATUSBAR_HEIGHT_X : kSTATUSBAR_HEIGHT))
#define kYM_TABBAR_HEIGHT (isIPAD ? kTABBAR_HEIGHT_IPAD : (isIPHONE_X_After ? kTABBAR_HEIGHT_X : kTABBAR_HEIGHT))
#define kYMBottomH (isIPAD ? 0.0f : (isIPHONE_X_After ? 34.0f : 0.0f))
#define kBottomJGH (isIPAD ? 0.0f : (isIPHONE_X_After ? 19.0f : 0.0f))


#define kRatio kScreenWidth/375
#define kRatio2 kScreenHeight/812
#define kWFit(num) kRatio * (num)
#define kHFit(num) kRatio2 * (num)

#define KEY_WINDOW ({ \
    UIWindow *keyWindow = nil; \
    if (@available(iOS 13.0, *)) { \
        UIWindowScene *windowScene = [UIApplication.sharedApplication.windows \
            firstObject].windowScene; \
        keyWindow = windowScene.windows.firstObject; \
    } \
    keyWindow; \
})

//字体
#define JPUIFont(x) [UIFont systemFontOfSize:x]
#define JPUIFontBold(x) [UIFont boldSystemFontOfSize:x]
#define JPUIFontPingFangSC(x) [UIFont fontWithName:@"PingFang SC" size:x]
#define JPUIFontPingFangSCThin(x) [UIFont fontWithName:@"PingFangSC-Thin" size:x]
#define JPUIFontPingFangSCRegular(x) [UIFont fontWithName:@"PingFang-SC-Regular" size:x]
#define JPUIFontPingFangSCMedium(x) [UIFont fontWithName:@"PingFangSC-Medium" size:x]
#define JPUIFontPingFangSCLight(x) [UIFont fontWithName:@"PingFangSC-Light" size:x]
#define JPUIFontPingFangBold(x) [UIFont fontWithName:@"PingFangSC-Semibold" size:x]
#define JPUIFontPingFangHeavy(x) [UIFont fontWithName:@"PingFang-SC-Heavy" size:x]
#define JPUIFontInterSemiBold(x) [UIFont fontWithName:@"Inter-SemiBold" size:x]
#define JPUIFontInterMedium(x) [UIFont fontWithName:@"Inter-Medium" size:x]
#define JPUIFontInterRegular(x) [UIFont fontWithName:@"Inter-Regular" size:x]
#define JPUIFontNotoSansJPRegular(x) [UIFont fontWithName:@"NotoSansJP-Regular" size:x]
#define JPUIFontNotoSansJPMedium(x) [UIFont fontWithName:@"NotoSansJP-Medium" size:x]

//颜色
#define UIColorRGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define UIColorRGBAlpha(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define UIColorHex_(rgbValue,Alpah) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:Alpah]
#define UIColorHex__(rgbValue) UIColorHex_(rgbValue,1.0)
#define KThemeColor UIColorHex(0x15CC9D)
#define KFontBlackColor UIColorHex(0x1C1F1E)
#define KFontGrayColor UIColorHex(0x868F99)
#define KLineColor UIColorHex(0xF5F5F5)
#define KbgColor UIColorHex(0xF5F5F5)
#define kCoinDetialBgColor(w,h) [UIColor bm_colorGradientChangeWithSize:CGSizeMake(w,h) direction:IHGradientChangeDirectionVertical startColor:UIColorHex_(0x15CC9D,0.2) endColor:UIColorHex_(0xffffff,0)]
#define kTopBgColor(w,h) [UIColor bm_colorGradientChangeWithSize:CGSizeMake(w,h) direction:IHGradientChangeDirectionVertical startColor:UIColorHex(0x86E5CE) endColor:UIColorHex_(0x86E5CE,0)]
#define kBasicsBgColor(w,h) [UIColor bm_colorGradientChangeWithSize:CGSizeMake(w,h) direction:IHGradientChangeDirectionVertical startColor:UIColorHex_(0xffffff,0.4) endColor:UIColorHex_(0xffffff,1)]

#define kCardBgColor(w,h) [UIColor bm_colorGradientChangeWithSize:CGSizeMake(w,h) direction:IHGradientChangeDirectionVertical startColor:UIColorHex(0xE0F7F0) endColor:UIColorHex(0xFFFFFF)]


#define JPAPPID @"6511247894"
#define WXAPPID @"wx30ba903ee5668ee7"
#define UNIVERSALLINK @"https://www.riyudao.com/"
#define SHARELINK @"https://www.riyudao.com/guanwang/app/wxIndex.html"
#define BUGLYID @"5c4d444c60"
#define ALIYUNYUYINKEY @"cYTsdxDtKjvy9ss6"

#endif /* GlobalMacros_h */
